<?php 
	  if(1==2){$HttpResult = new HttpResult();}
	  $HttpContentResult = $HttpResult->getHttpContentResult();
	  
//	  Debug::print_r($HttpResult);exit();
		$head = new HtmlHeader($HttpContentResult->getHeader());    
		$head->addCSS(array('reset','admin','order_admin'));
		$head->addCSS('print','', 'print');
		$head->addCSS('ie',  'css/ie', 'print',true);
		
		//<!-- SWF OBJECT -->
		$head->addJS('swo', 'js/swfobject/swfobject');
		
		//<!-- PROGRAMACAO JS | JQUERY  -->
		$head->addJS(array('jquery', 'masked','admin'));
		//MENU DROPDOWN
    $head->addJS('Menu principal','js/menu/ddsmoothmenu');
    $head->addCSS('Menu CSS','js/menu/ddsmoothmenu');
		//<!-- JQUERY UI  -->
		$head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
		$head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');
		
		//<!-- TABLE SORTER -->
		$head->addJS('tablesorter', 'js/tablesorter/tablesorter');
		$head->addCSS('tablesorter', 'js/tablesorter/tablesorter');
		
		$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;

$ContentResult = $HttpResult->getHttpContentResult();

$status[0] = 'não concluídos';
$status[1] = 'aguardando';
$status[2] = 'finalizados';

?>
 
<body>

<div id="main">
      <?php include "view/democrart/parts/admin/header.php" ?>
      
	  <div id="main_content">
	  
	  <div id="msgBox"></div>
	  			
		<div id="box_left">
		 </div>
		  
		 <div id="box_right">
			<h1>Listar Pedidos - (<?php echo $status[$ContentResult->status_list]; ?>)</h1>
		<?php	
		
		if(!$HttpResult->getSuccess() || !count($ContentResult->array_pedidos_abertos) > 0):
			echo "Você não possui nenhum pedido a ser listado.";
		else:
		?>
				
			<div style="clear:both">
				<span class="count"><?php echo count($ContentResult->array_pedidos_abertos); ?> registro(s)</span>
				<table class="tablesorter">
					<thead>
						<tr>
							<th>Nº</th>
							<th>Cliente</th>
							<th>Produtos (resumo)</th>
							<th>Pedido em</th>
							<th>Total</th>
							<th>Detalhes</th>
						</tr>
					</thead>
					<tbody>
					<?php 
					
						foreach($ContentResult->array_pedidos_abertos as $PurchaseStdVO):
							
							// Debug::print_r($PurchaseStdVO);
					?>
						<tr>
							<td><?php echo $PurchaseStdVO->id; ?></td>
							<td><?php echo $PurchaseStdVO->recipient_name; ?></td>
							<td>
								<?php $i = 1; foreach ( $PurchaseStdVO->array_itens as $item): ?>
									<?php echo "(" , $item->quantity , ") " , (($item->product_name == "")?$item->product_vo->product_model_name:$item->product_name) , " - " ,$item->product_description; ?> <br/>								
								<?php $i++; endforeach; ?>
							</td>
							<td><?php echo $PurchaseStdVO->date_order?></td>
							<td><?php echo DataHandler::convertMoneyToBrazil($PurchaseStdVO->total_value) ; ?></td>	
							<td class="ico"><a href="<?php echo Config::getRootPath("admin/purchase_order/detail/id." . $PurchaseStdVO->id); ?>">
							<img id="ver00125" src="<?php echo Config::getAsset("assets/img/icons/visualizar.png");?>" alt="Visualizar" title="Ver detalhes do pedido" /></a></td>
						</tr>
					<?php endforeach; ?>

					</tbody>
				</table>
			</div>
		
		</div>
		
		<?php endif; ?>
			<!-- FIM DO QUADRO -->
	</div>
</div>

</body>
</html>